/******************************************************************
 * created by yang.zheng on 2020-07-29 for mongodb connection file
*******************************************************************/

//引入mongoose插件
const mongo = require('mongoose')

//引入配置文件
const {MONGODB_PATH} = require('../config')
const {logs} = require('../utils')

//链接数据库
mongo.connect(MONGODB_PATH)

//链接数据库结果
mongo.connection.on('connected',() => {
    logs('mongo conncet success')
})
mongo.connection.on('error',(e) => {
    logs('mongo conncet error',e)
})

//导出mongo对象
module.exports = mongo